n=10
run_test="3B"
rm -rf debug.txt
ok=1
for ((i=1; i<=n; i++)); do
  go test -run $run_test  | tee debug.txt
  echo 第$i次运行完毕
  if [ `grep -c "FAIL" debug.txt` -ne '0' ]; then
    echo "test failed and log in debug.txt"
    ok=0
    break
  else
    rm -rf debug.txt
  fi
  sleep 3
done;

if [ $ok -eq 1 ]; then
  echo "congratulate, all tests passed"
else
  echo "some thing error, please see the debug.txt to debug"
fi

read -p "please enter to continue" x